python list minus list

114

python list minus list -

[item for item in x if item not in y]

credit to aaronasterling from stackoverflow

subtract list from list python -

>>> z = list(set(x) - set(y))
>>> z
[0, 8, 2, 4, 6]

Comments

Submit
0 Comments